package com.droowa.model.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.droowa.domain.OrderInfo;
import com.droowa.domain.OrderList;
import com.droowa.domain.OrderProduct;
import com.droowa.model.dao.OrderDAO;
@Service
public class OrderServiceImpl implements OrderService{

	@Autowired
	private OrderDAO dao;

//####################### OrderInfo Service ########################	
	@Override
	// 바로구매시에 입력한 정보를 dao를 호출하여 전달
	public int joinOrderInfo(OrderInfo orderInfo) throws SQLException {
		return dao.insertOrderInfo(orderInfo);
	}

	
	
	
//####################### OrderProduct Service ########################	
	@Override
	public int joinOrderProduct(OrderProduct orderProduct) throws SQLException {
		return dao.insertOrderProduct(orderProduct);
	}

	@Override 
	public OrderProduct getOrderProduct(String orderProductId) throws SQLException {
		return dao.getOrderProductById(orderProductId);
	}

	@Override //장바구니에 들어간 상품을 구분하기위해 result-> true
	public int modifyOrderProductResult(String completeId) throws SQLException {
		return dao.updateOrderProductResult(completeId);
	}
	
	@Override //결제한상품을 구분하기위해 result -> false
	public int modifyOrderProductResultFalse(String completeId) throws SQLException {
		return dao.updateOrderProductResultFalse(completeId);
	}

	@Override
	public List<OrderProduct> getOrderListById(String custId) throws SQLException {
		return dao.getOrderListById(custId);
	}
	
	@Override
	public int removeOrderProductById(String custId, String completeId) throws SQLException{
		return dao.deleteOrderProduct(custId, completeId);
	}


	
	@Override
	public int joinOrderList(OrderList orderList) throws SQLException {
		return dao.insertOrderList(orderList);
	}




	@Override
	public List<OrderList> getOrderListByCustId(String custId) throws SQLException {
		System.out.println("서비스");
		return dao.getOrderListByCustId(custId);
	}


	
	
	


}
